package com.videoanalysis.recognizer;

import com.videoanalysis.config.AppConfig;
import lombok.extern.slf4j.Slf4j;

/**
 * 图像识别器工厂类，根据配置创建合适的图像识别器实例
 */
@Slf4j
public class ImageRecognizerFactory {

    /**
     * 创建图像识别器实例
     * @return 图像识别器实例
     */
    public static ImageRecognizer createImageRecognizer() {
        String recognizerType = AppConfig.getInstance().getRecognition().getType();
        log.info("创建图像识别器: {}", recognizerType);

        switch (recognizerType.toLowerCase()) {
            case "tencent":
                return new TencentCloudImageRecognizer();
            case "local":
                return new LocalImageRecognizer();
            default:
                log.warn("未知的图像识别器类型: {}，将使用默认的腾讯云图像识别器", recognizerType);
                return new TencentCloudImageRecognizer();
        }
    }
}
